package com.atguigu.gmall.product.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ClassName: MyBatisPlusConfig
 * Package: com.atguigu.gmall.product.config
 * Description:
 *
 * @Author ltystart
 * @Create 2025/8/20 18:30
 * @Version 1.0
 */
@Configuration
public class MyBatisPlusConfig {
    /**
     * 最大的拦截器，主体拦截器
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        //1.创建拦截器主体
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //2.引入分页拦截器
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
        paginationInnerInterceptor.setOverflow(true);
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        return interceptor;
    }
}
